<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>索引范围判断</title>
		<link rel="stylesheet" type="text/css" href="css/txt.css" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<table border="1px" cellpadding="5px" cellspacing="0px">
			<tr>
				<td>1-1、hello</td>
				<td>1-2、hello</td>
				<td>1-2、hello</td>
			</tr>
			<tr>
				<td>2-1、hello</td>
				<td>2-2、hello</td>
				<td>2-3、hello</td>
			</tr>
			<tr>
				<td>3-1、hello</td>
				<td>3-2、hello</td>
				<td>3-3、hello</td>
			</tr>
		</table>

	</body>

	<script type="text/javascript">
		$(function() {
			// 设置tr索引为0的样式背景为蓝色
			$("tr:eq(0)").css("background","blue");
			// 设置td索引大于3的样式为txt
			$("td:gt(3)").attr("class","txt");
			// 设置td索引小于3的样式为白色
			$("td:lt(4)").css("background","white");

		});
	</script>

</html>